package com.qiaofang.applet.service.other.service.mapstruct;

import com.qiaofang.applet.constants.PropertyImageConstants;
import com.qiaofang.applet.service.other.domain.SignContact;
import com.qiaofang.applet.service.other.service.dto.SignContactListDto;
import com.qiaofang.applet.service.property.domain.PropertyVr;
import com.qiaofang.applet.service.property.service.dto.PropertyImageDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;

import java.text.SimpleDateFormat;
import java.util.List;

/**
 * @Author: youqing.yang
 * @Create: 2020/10/23 15:27
 * @Description:
 **/
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SignContactMapper {

    List<SignContactListDto> domainListToDtoList(List<SignContact> signContactList);

    default SignContactListDto domainToDto(SignContact signContact) {
        if (signContact == null) {
            return null;
        }

        SignContactListDto signContactListDto = new SignContactListDto();
        signContactListDto.setContactName( signContact.getContactName() );
        signContactListDto.setEmployeeName( signContact.getEmployeeName() );
        signContactListDto.setStatus( signContact.getStatus() );
        signContactListDto.setSignStatus( signContact.getSignStatus() );
        signContactListDto.setContactUuid( signContact.getContactUuid() );
        String startSignTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                .format(signContact.getStartSignTime());
        signContactListDto.setStartSignTime(startSignTime);
        return signContactListDto;
    }
}
